package com.yyd.designmodel.observer.impl;

import java.util.Observable;

/**
 * 
 * @Description：[ 作者类，继承被观察者类 ]
 *
 * @ProjectName：[designmodel]
 * @PackageName：[com.yyd.designmodel.observer.impl.Writer]
 * @CreateDate：[2015-1-20  上午10:18:26] 
 * @Author：[yuyidi]
 */
public class Writer extends Observable {
    private String name;//作者名称
    private String lastNovel;//记录作者最新发布的小说
    
    public Writer(String name) {
        super();
        this.name = name;
        WriterManager.getInstence().add(this);
    }
    
    public void addNovel(String novel){
        System.out.println(name+"发布了新书《"+novel+"》！");
        lastNovel=novel;
        setChanged();
        notifyObservers();
    }

    public String getName() {
        return name;
    }

    public String getLastNovel() {
        return lastNovel;
    }
}
